/*
 * @Author: 贾博林 11457230+jabolin@user.noreply.gitee.com
 * @Date: 2023-03-29 09:58:59
 * @LastEditors: 贾博林 11457230+jabolin@user.noreply.gitee.com
 * @LastEditTime: 2023-03-30 10:58:54
 * @FilePath: \zs-grouting2\naive-ui-admin\src\main.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { App as VueApp, createApp } from 'vue'
import App from './App.vue'
import {
  create,
  NButton,
  NCheckbox,
  NCheckboxGroup,
  NDataTable,
  NDatePicker,
  NDrawer,
  NDrawerContent,
  NInput,
  NInputNumber,
  NRadio,
  NRadioGroup,
  NSelect,
  NSpace,
  NSpin,
  NTimePicker,
  NTransfer,
  NUpload,
  NTree
} from 'naive-ui'
import { registerStore } from './store'
import { registerRouter } from './router'
import { registerI18n } from './locales'
import './assets/scss/index.scss'
import { registerHttp } from './modules/common/http'
import '@/assets/iconfont/iconfont.css'
import { butterflyUI } from './components'

const bootstrap = () => {
  const app = createApp(App)
  registerI18n(app)
  registerRouter(app)
  registerStore(app)
  registerGlobalComponents(app)
  registerHttp()
  app.mount('#app')
}
bootstrap()

function registerGlobalComponents(app: VueApp) {
  const naive = create({
    components: [
      NButton,
      NDrawer,
      NDrawerContent,
      NInput,
      NInputNumber,
      NSpace,
      NDataTable,
      NSelect,
      NTimePicker,
      NDatePicker,
      NTransfer,
      NRadioGroup,
      NRadio,
      NCheckboxGroup,
      NCheckbox,
      NUpload,
      NSpin,
      NTree
    ]
  })
  app.use(butterflyUI)
  app.use(naive)
}
